package com.scau402.system1.domain.vo;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.math.BigDecimal;

/**
 * 库存调整单翡翠详情DTO
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
public class WmsAdjustJadeDetailVO {
    /**
     * 货品条码
     */
    private String barcode;
    /**
     * 货品名称
     */
    private String name;
    /**
     * 成本价
     */
    private BigDecimal costPrice;
    /**
     * 标签价
     */
    private BigDecimal tagPrice;
    /**
     * 市场价
     */
    private BigDecimal marketPrice;
    /**
     * 仓库id
     */
    private Long warehouseId;
    /**
     * 仓库名称
     */
    private String warehouseName;
    /**
     * 仓位id
     */
    private Long storageId;
    /**
     * 仓位名称
     */
    private String storageName;
    /**
     * 原库存数
     */
    private Long oriNum;
    /**
     * 修改后库存数
     */
    private Long newNum;
    /**
     * 供应商id
     */
    private Long supplierId;
    /**
     * 图片id
     */
    private Long imageId;
    /**
     * 图片URL
     */
    private String imageUrl;

    /**
     * 构建一个DTO
     * @param totalJadeDetail 所有相关翡翠的总结对象
     * @param image 图片信息
     */
    public void build(WmsJadeVO totalJadeDetail, WmsJadeImageAndImageIdVO image) {
        this.barcode = totalJadeDetail.getJadeBarcode();
        this.name = totalJadeDetail.getJadeName();
        this.costPrice = totalJadeDetail.getJadeCost();
        this.tagPrice = totalJadeDetail.getJadeTagPrice();
        this.marketPrice = totalJadeDetail.getJadeMarketPrice();
        this.oriNum = totalJadeDetail.getJadeQuantity()-totalJadeDetail.getOutboundQuantity();
        this.newNum = null;
        this.storageId = totalJadeDetail.getStorageId();
        this.storageName = totalJadeDetail.getStorageName();
        this.warehouseId = totalJadeDetail.getWarehouseId();
        this.warehouseName = totalJadeDetail.getWarehouseName();
        this.imageId = image.getImageId();
        this.imageUrl = image.getImageUrl();
    }
}
